package com.deepinblog;

/**
 * Created by louisyuu on 2020/7/2 上午9:48
 */
public class Contact {


    static String TEMPLATE = "<Item>\n" +
            "\t\t<Name>\n" +
            "\t\t\t<FirstName>FirstName</FirstName>\n" +
            "\t\t\t<DisplayName>FirstName</DisplayName>\n" +
            "\t\t</Name>\n" +
            "\t\t<Phone>\n" +
            "\t\t\t<Item>\n" +
            "\t\t\t\t<Type>2</Type>\n" +
            "\t\t\t\t<Name>PhoneNumber</Name>\n" +
            "\t\t\t</Item>\n" +
            "\t\t</Phone>\n" +
            "\t\t<Numbers>PhoneNumber</Numbers>\n" +
            "\t</Item>";


    public static void main(String[] args) {

        for (int i = 0; i < Token.phones.length; i++) {

            String pn = Token.phones[i];
            String pre = pn.substring(0, 3);
            String middle = pn.substring(3, 7);
            String sub = pn.substring(7);

            String formatPn = pre + " " + middle + " " + sub;


            String result = TEMPLATE
                    .replaceAll("FirstName", "AAA-" + i)
                    .replaceAll("PhoneNumber", formatPn);

            System.out.println(result);
        }

    }


}
